package com.wm.task1;

import java.text.SimpleDateFormat;
import java.util.Date;

public class ThreadTwo implements Runnable {
    public void print() {
        for (int i = 0; i < 100; i++) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd HH:mm:ss");
            Date now = new Date();
            String format = simpleDateFormat.format(now);
            if (i % 2 == 0) {
                System.out.println("线程B" + format + "打印" + i);
            }

        }

    }

    public void begin() {
        Thread th = new Thread(this);
        th.start();
    }

    public void run() {
        this.print();
    }

}
